package com.xiaofeng.service.iserviceimpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaofeng.common.Const;
import com.xiaofeng.dao.idao.TransferDao;
import com.xiaofeng.pojo.Page;
import com.xiaofeng.pojo.Transfer;
import com.xiaofeng.service.iservice.TransferService;


@Service("transferService")
public class TransferServiceImpl implements TransferService{
	
	@Autowired
	private TransferDao td;

	@Override
	public String insert(Transfer transfer) {
		String msg = Const.ERROR;
		try {
			td.insert(transfer);
			msg = Const.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return msg;
	}

	@Override
	public String delete(Transfer transfer) {
		String msg = Const.ERROR;
		try {
			td.delete(transfer);
			msg = Const.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return msg;
		
	}

	@Override
	public String update(Transfer transfer) {
		String msg = Const.ERROR;
		try {
			td.update(transfer);
			msg = Const.SUCCESS;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return msg;
	}

	@Override
	public Transfer findById(int id) {
		Transfer transfer = null;
		try {
			transfer = td.findById(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return transfer;
	}

	@Override
	public List<Transfer> findAll(int num,int size) {
		List<Transfer> list = null;
		try {
			list = td.findAll(num, size);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return list;
	}

	@Override
	public Page<Transfer> findByPageNo(int pageNo) {
		Page<Transfer> page = null;
		try {
			page = td.findByPageNo(pageNo);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return page;
	}
	
}	
